#include <stdio.h>

unsigned invert(unsigned x,int p,int n);

int main(void)
{
    printf("%u\n",invert(83U,3,3));
}

unsigned invert(unsigned x,int p,int n)
{
    return x ^ (~(~0<<n)<<(p+1-n));
}